<template>
  <div @click="clickFn" :class="{ canclick: config?.isClick && value && value != 0 }">
    {{ value }}
  </div>
</template>

<script setup>
  import { usePermission } from '@/hooks/usePermission'
  // import { formatNumber } from '@/utils'
  const props = defineProps({
    config: Object,
    value: [String, Number],
    record: Object,
  })
  const clickFn = () => {
    if (props.config?.isClick && props.value && props.value != 0) {
      if (props.config?.permission) {
        usePermission(props.config?.permission) && props.config?.clickMethod(props.record)
      } else {
        props.config?.clickMethod(props.record)
      }
    }
  }
</script>
<style scoped lang="less">
  .canclick {
    text-decoration: underline;
  }
  .canclick:hover {
    cursor: pointer;
    color: #1890ff;
  }
</style>
